{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "runsheepit.ipynb",
      "provenance": [],
      "toc_visible": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "sPH6KdUPDgg_",
        "colab_type": "text"
      },
      "source": [
        "Hello! This script will allow you to get [Sheep It](https://www.sheepit-renderfarm.com) render credits without bogging down your own machine. Follow the steps below to get started.\n",
        "For more documentation:\n",
        "[My YouTube](https://bit.ly/ab3dchannel) | [My GitHub](https://github.com/ab3d-studio)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "HLPvgVXZpbOB",
        "colab_type": "text"
      },
      "source": [
        "Here add your login and password for Sheep-It. This goes straight to Sheep It for authentication."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "_BHR0rXHiFmb",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "login = '' #@param {type: \"string\"}\n",
        "password = '' #@param {type: \"string\"}"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "8oTXdJOfpmQn",
        "colab_type": "text"
      },
      "source": [
        "Installing Sheep-It."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "mPGaFHFQOuzL",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "!sudo apt-get install openjdk-11-jre libglu1-mesa\n",
        "!wget https://www.sheepit-renderfarm.com/media/applet/client-latest.php -O sheepit-client.jar"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "QjQztYeQnriw",
        "colab_type": "text"
      },
      "source": [
        "From donmahallam's [blender script for Google Colab](https://github.com/donmahallem/colab_blender/blob/master/runblender.ipynb). It is required because \"some weird behaviors with libtcmalloc appeared in the colab VM\". Thanks to donmahallem for that. "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Uk0cwkvvnFI4",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "import os\n",
        "\n",
        "os.environ[\"LD_PRELOAD\"] = \"\"\n",
        "\n",
        "!apt update\n",
        "!apt remove libtcmalloc-minimal4\n",
        "!apt install libtcmalloc-minimal4\n",
        "os.environ[\"LD_PRELOAD\"] = \"/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4.3.0\"\n",
        "\n",
        "!echo $LD_PRELOAD"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "uEKBdQekprUA",
        "colab_type": "text"
      },
      "source": [
        "Now for the part you have been waiting for! This will log you into the Sheep-it client and automatically start a job. It will automatically get new jobs until you cancel it. Go to the sheep it website for more details on its jobs."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Qy1SqUUgPXGZ",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        "!java -jar sheepit-client.jar -ui text -login {login} -password {password}"
      ],
      "execution_count": null,
      "outputs": []
    }
  ]
}
